//2009/08/22 12:54:33
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class PersistentNumber
{
public:
    int getPersistence(int n)
    {
		int ret = 0;
		while(n>9)
		{
			ret++;
			n = sum(n);
		}
		return ret;
    }
private:
    int sum(int n)
    {
        int product = 1;
        while (n!=0)
        {
            int a = n % 10;
            product *= a;
            n /= 10;
        }
		return product;
    }
};
